﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<OneDollarStore.SerialProduct>" %>

<fieldset>
    <legend style="font-style:italic; text-align:center">Thông tin Sản Phẩm</legend>
    <!-- General information -->
        <!-- Name -->
        <div class="display-label">Tên: </div>
        <div class="display-field"><b><%= Html.Encode(Model.Name) %></b></div>
        <!-- Description -->
        <div class="display-label">Mô tả: </div>
        <div class="display-field"><%= Html.Encode(Model.Description) %></div>
        <!-- Warranty -->
        <div class="display-label">Bảo hành: </div>
        <% if (Model.Warranty.Value > 1)
           { %>
            <div class="display-field"><%= Html.Encode(Model.Warranty)%> Năm</div>
        <% }
           else
           { %>
            <div class="display-field"><%= Html.Encode(Model.Warranty)%> Năm</div>
        <% } %>
        <!-- Retail Price and Promotion Price -->
        <% if (String.IsNullOrEmpty(Model.PromotionPrice.ToString()) || 
               ((!String.IsNullOrEmpty(Model.PromotionPrice.ToString())) && (DateTime.Now.Date > Model.PromotionEndDate)))
           { %>
            <div class="display-label">Retail Price: </div>
            <div class="display-field">
                <strong style="color:Red"><%= Html.Encode(String.Format("{0:c}", Model.RetailPrice)) %></strong>
            </div>
        <% }
           else
           { %>
            <div class="display-label">Retail Price: </div>
            <div class="display-field" style="text-decoration:line-through"><%= Html.Encode(String.Format("{0:c}", Model.RetailPrice)) %></div>
            <div class="display-label">Giá khuyến mãi: </div>
            <div class="display-field">
                <strong style="color:Red"><%= Html.Encode(String.Format("{0:c}", Model.PromotionPrice)) %></strong>
            </div>
        <% } %>
    <!-- Specific information -->
        <% if (Model.Category.Name == "Laptop") // Laptop product
           { %>
            <!-- Mainboard -->
            <div class="display-label">Mainboard: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.Mainboard)%></div>
            <!-- CPU -->
            <div class="display-label">CPU: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.CPU)%></div>
            <!-- RAM -->
            <div class="display-label">RAM: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.RAM)%></div>
            <!-- HDD -->
            <div class="display-label">HDD: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.HDD)%></div>
            <!-- VGA -->
            <div class="display-label">VGA: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.VGA)%></div>
            <!-- CD/DVD -->
            <div class="display-label">CD/DVD: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.CDDVD)%></div>
            <!-- Screen -->
            <div class="display-label">Screen: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.Screen)%></div>
            <!-- Webcam -->
            <div class="display-label">Webcam: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.Webcam)%></div>
            <!-- Operating System -->
            <div class="display-label">Operating System: </div>
            <div class="display-field"><%= Html.Encode(Model.Laptop.OperatingSystem)%></div>
        <% }
           else if (Model.Category.Name == "Desktop") // Desktop product
           { %>
            <!-- Mainboard -->
            <div class="display-label">Mainboard: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.Mainboard)%></div>
            <!-- CPU -->
            <div class="display-label">CPU: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.CPU)%></div>
            <!-- RAM -->
            <div class="display-label">RAM: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.RAM)%></div>
            <!-- HDD -->
            <div class="display-label">HDD: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.HDD)%></div>
            <!-- VGA -->
            <div class="display-label">VGA: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.VGA)%></div>
            <!-- CD/DVD -->
            <div class="display-label">CD/DVD: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.CDDVD)%></div>
            <!-- Network -->
            <div class="display-label">Network: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.Network)%></div>
            <!-- Operating System -->
            <div class="display-label">Operating System: </div>
            <div class="display-field"><%= Html.Encode(Model.Desktop.OperatingSystem)%></div>
        <% }
           else if (Model.Category.Name == "Mainboard") // Mainboard product
           { %>
            <!-- Chipset -->
            <div class="display-label">Chipset: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.Chipset)%></div>
            <!-- Socket -->
            <div class="display-label">Socket: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.Socket)%></div>
            <!-- SupportedCPU -->
            <div class="display-label">SupportedCPU: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.SupportedCPU)%></div>
            <!-- SupportedRAM -->
            <div class="display-label">SupportedRAM: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.SupportedRAM)%></div>
            <!-- USBPort -->
            <div class="display-label">USBPort: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.USBPort)%></div>
            <!-- LAN -->
            <div class="display-label">LAN: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.LAN)%></div>
            <!-- Audio -->
            <div class="display-label">Audio: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.Audio)%></div>
            <!-- BIOS -->
            <div class="display-label">BIOS: </div>
            <div class="display-field"><%= Html.Encode(Model.Mainboard.BIOS)%></div>
        <% }
           else if (Model.Category.Name == "CPU") // CPU product
           { %>
            <!-- Socket -->
            <div class="display-label">Socket: </div>
            <div class="display-field"><%= Html.Encode(Model.CPU.Socket)%></div>
            <!-- Speed -->
            <div class="display-label">Speed: </div>
            <div class="display-field"><%= Html.Encode(Model.CPU.Speed)%></div>
            <!-- L2Cache -->
            <div class="display-label">L2Cache: </div>
            <div class="display-field"><%= Html.Encode(Model.CPU.L2Cache)%></div>
            <!-- L3Cache -->
            <div class="display-label">L3Cache: </div>
            <div class="display-field"><%= Html.Encode(Model.CPU.L3Cache)%></div>
        <% }
           else if (Model.Category.Name == "RAM") // RAM product
           { %>
            <!-- Type -->
            <div class="display-label">Type: </div>
            <div class="display-field"><%= Html.Encode(Model.RAM.Type)%></div>
            <!-- Speed -->
            <div class="display-label">Speed: </div>
            <div class="display-field"><%= Html.Encode(Model.RAM.Speed)%></div>
            <!-- Memory -->
            <div class="display-label">Memory: </div>
            <div class="display-field"><%= Html.Encode(Model.RAM.Memory)%></div>
        <% }
           else if (Model.Category.Name == "HDD") // HDD product
           { %>
            <!-- Storage -->
            <div class="display-label">Storage: </div>
            <div class="display-field"><%= Html.Encode(Model.HDD.Storage)%></div>
            <!-- Speed -->
            <div class="display-label">Speed: </div>
            <div class="display-field"><%= Html.Encode(Model.HDD.Speed)%></div>
            <!-- Cache -->
            <div class="display-label">Cache: </div>
            <div class="display-field"><%= Html.Encode(Model.HDD.Cache)%></div>
        <% }
           else if (Model.Category.Name == "VGA") // VGA product
           { %>
            <!-- Chipset -->
            <div class="display-label">Chipset: </div>
            <div class="display-field"><%= Html.Encode(Model.VGA.Chipset)%></div>
            <!-- Video Memory -->
            <div class="display-label">Video Memory: </div>
            <div class="display-field"><%= Html.Encode(Model.VGA.VideoMemory)%></div>
        <% } %>
</fieldset>